import Vue from "vue";
import Router from "vue-router";

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch((err) => err);
};

Vue.use(Router);

export default new Router({
  mode: "history",
  redirect: "/role",
  routes: [
    {
      path: "/login",
      component: () => import("@/views/login"),
      hidden: true,
    },
    {
      path: "/role",
      component: () => import("@/views/chooseRole"),
      hidden: true,
    },
    {
      path: "/bgt",
      component: () => import("@/views/pgt"),
      hidden: true,
    },
    {
      path: "/home",
      component: () => import("@/views/shgzfwpt/home"),
      hidden: true,
    },
    {
      path: "/yjjy",
      component: () => import("@/views/shgzfwpt/yjjy/index"),
      hidden: true,
    },
    {
      path: "/yjjy-detail",
      component: () => import("@/views/shgzfwpt/yjjy/detail"),
      hidden: true,
    },
    {
      path: "/rank-top",
      component: () => import("@/views/shgzfwpt/travel/rank"),
      hidden: true,
    },
    {
      path: "/xjjl",
      component: () => import("@/views/shgzfwpt/xjgl/xjjl"),
      hidden: true,
    },
    {
      path: "/zcjl",
      component: () => import("@/views/shgzfwpt/zcgl/zcjl"),
      hidden: true,
    },
    {
      path: "/zcjl-detail",
      component: () => import("@/views/shgzfwpt/zcgl/detail"),
      hidden: true,
    },
    {
      path: "/xjjl-detail",
      component: () => import("@/views/shgzfwpt/xjgl/detail"),
      hidden: true,
    },
    {
      path: "/zcjl-add",
      component: () => import("@/views/shgzfwpt/zcgl/add"),
      hidden: true,
    },
    {
      path: "/xjjl-add",
      component: () => import("@/views/shgzfwpt/xjgl/add"),
      hidden: true,
    },
    {
      path: "/xjjl-jkfmx",
      component: () => import("@/views/shgzfwpt/xjgl/jkfmx"),
      hidden: true,
    },
    {
      path: "/xjjl-sjfk",
      component: () => import("@/views/shgzfwpt/xjgl/sjfk"),
      hidden: true,
    },
    {
      path: "/nologin-yjjy",
      component: () => import("@/views/shgzfwpt/jy"),
      hidden: true,
    },
  ],
});
